home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / ARASAN_S.ZIP / DISPLAY.H < prev    next >
C/C++ Source or Header  |  1994-08-05  |  3KB  |  89 lines

  1. // Copyright 1993 by Jon Dart.  All Rights Reserved
  2.  
  3. // This module handles the display of the board.
  4.  
  5. #include <wpp.h>
  6. #include <wpgdi.h>
  7. #include "board.h"
  8. #include "search.h"
  9. #include <time.h>
  10.  
  11. class Display
  12. {
  13. public:
  14.  
  15.      Display( WPWin *win, const WPRect &initial_size );
  16.      
  17.      ~Display();
  18.      
  19.      void set_size(WPRect &size);
  20.  
  21.      const WPRect & get_size() const
  22.      {
  23.     return display_area;
  24.      }
  25.  
  26.      void square_rect( const Square &, WPRect & );
  27.      // update WPRect with the boundary of the given square.
  28.  
  29.      void draw_board( WPDevContext &, const Board &, const WPRect *draw_Area);
  30.      void draw_piece( WPDevContext &, const Square&, const Piece & );
  31.      void draw_square( WPDevContext &, const Square & );
  32.      void highlight_square( WPDevContext &, const Square & );
  33.      void unhighlight_square( WPDevContext &, const Square & );
  34.      
  35.      void set_turned( Boolean turnit );
  36.      Boolean is_turned() const
  37.      {
  38.          return turned;
  39.      }
  40.  
  41.      Square mouse_loc( WPPoint &);
  42.      // given where the mouse is, tell us what square it's on.
  43.      
  44.      void show_side( WPDevContext &, const ColorType side );
  45.      // show side to move
  46.          
  47.      void show_move( WPDevContext &, const char *move_image,
  48.          int number );
  49.      // show last move made. 
  50.          
  51.      void show_status( WPDevContext &, const Search::Statistics stats);
  52.      // show status afer last move.
  53.      
  54.      static void show_time( HWND handle, const time_t time, 
  55.          const ColorType side );
  56.      // show elapsed time for 'side'.  This takes a handle rather than
  57.      // a WPDevContext and is static so that it can be called from within
  58.      // a callback fn.         
  59.          
  60.      void clear_search_counts(  WPDevContext &dc );
  61.      // clear the "ply" and "nodes" display region.
  62.  
  63.      void clear_move_area( WPDevContext &dc );
  64.      // clear the region that displays the last move.
  65.  
  66.      void clear_status_line( WPDevContext &dc );
  67.      // erase the area for search messages (e.g. "Check")
  68.      
  69.      static void show_search_counts( HWND handle, const int ply,
  70.          const long nodes);
  71.      // show status during a search.
  72.          
  73. private:
  74.      void draw_piece(WPDevContext &dc,
  75.                WPRect &square,WPBitmap *bitmap,WPRect &src_rect,
  76.                const ColorType color, WPBitmap *outline = NULL);
  77.      void draw_piece( WPDevContext &dc, WPRect &square, const Piece &piece);
  78.  
  79.      WPRect display_area;
  80.      int square_width;
  81.      int square_height;
  82.      Search::Statistics current_status;
  83.      Boolean turned;
  84.      int width, height; // size of display area
  85.      int vertical_border_width, horiz_border_height;
  86.      int max_char_width, char_width, char_height;
  87.      static int spacing;
  88. };
  89.